/**
 * 
 */
package jmine.tec.test.proxy;

import jmine.tec.proxy.chain.ChainElement;
import jmine.tec.proxy.chain.InvocationChain;

/**
 * Analogo a {@link MockObjectInvocationHandler}, exceto que opera sobre uma cadeia de invocacao
 * 
 * @author takeshi
 */
public class MockObjectChainElement extends AbstractMockObjectChainElement implements ChainElement {

    /**
     * Para a chamada prematuramente, devolvendo ou um valor default ou o valor especificado no mapa em {@link #getValues()}
     * 
     * @param chain o {@link InvocationChain}
     * @return {@link Object}
     * @throws Throwable t
     * @see br.com.maps.util.proxy.chain.ChainElement#aroundInvoke(br.com.maps.util.proxy.chain.InvocationChain)
     */
    @Override
    protected Object unespecifiedMethod(InvocationChain chain) throws Throwable {
        return MockObjectSupport.getDefaultValueFor(chain.getInvokingMethod().getReturnType());
    }

}
